//
//  NYTagsButton.m
//  百思不得姐
//
//  Created by Apple on 15/8/26.
//  Copyright (c) 2015年 Neal. All rights reserved.
//

#import "NYTagsButton.h"

@implementation NYTagsButton

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        self.titleLabel.font = [UIFont systemFontOfSize:15];
        [self setBackgroundColor:NYTagBgColor];
        [self setImage:[UIImage imageNamed:@"chose_tag_close_icon"] forState:UIControlStateNormal];
        
    }
    return  self;
}
- (void)setTitle:(NSString *)title forState:(UIControlState)state
{
    [super setTitle:title forState:state];
    [self sizeToFit];
    self.height = NYtagButtonHeight;
    self.width  += 3 * SmallMargin;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.titleLabel.x = SmallMargin;
    self.imageView.x = CGRectGetMaxX(self.titleLabel.frame) + SmallMargin;
}
@end
